package com.cesce.batch.cobros.validation;


import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springmodules.validation.valang.functions.AbstractFunction;
import org.springmodules.validation.valang.functions.Function;

import com.cesce.batch.cobros.dominio.Comunicados;
import com.cesce.batch.cobros.reverse.Cobcomunicados;
import com.cesce.batch.cobros.reverse.Cobformatofechacobros;
import com.cesce.batch.cobros.reverse.Cobformatoimportes;
import com.cesce.batch.cobros.reverse.Cobparametros;
import com.cesce.batch.cobros.reverse.Cobregistro;


public class IsNumerico extends AbstractFunction {
	
		protected final Log logger = LogFactory.getLog(getClass());

	    public IsNumerico(Function[] arguments, int line, int column) {
	        super(arguments, line, column);
	        definedExactNumberOfArguments(1);
	    	}
	
	    
		@SuppressWarnings("unchecked")
		protected Object doGetResult(Object target) throws Exception {
			String valor= (String) getArguments()[0].getResult(target);
			String valorNumerico= valor.replace(",","").replace(".","").replace("-","");

			try {
				int number = Integer.parseInt(valorNumerico);
				} 
			catch (Exception e) {
				return Boolean.FALSE;
				}
			return Boolean.TRUE;

			}
	}

